package com.deepface.framework.handler;

import com.rabbitmq.client.Channel;
import com.deepface.framework.config.RabbitMQConfig;
import com.deepface.framework.web.domain.server.Sys;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName ReceiveHandler
 * @Description
 * @Author 74707
 * @Date 2023/12/16 14:39
 * @Version V1.0
 */
@Component
public class ReceiveHandler {
  /**
   * 监听email队列
   */
  @RabbitListener(queues = {RabbitMQConfig.QUEUE_INFORM_EMAIL})
  public void receive_email(Object msg, Message message, Channel channel){
    System.out.println("QUEUE_INFORM_EMAIL msg"+msg);
  }
  /**
   * 监听sms队列
   */
  @RabbitListener(queues = {RabbitMQConfig.QUEUE_INFORM_SMS})
  public void receive_sms(Object msg, Message message, Channel channel){


  }

  /**
   * 监听log_queue队列
   */
  @RabbitListener(queues = {RabbitMQConfig.LOG_QUEUE})
  public void receive_log_queue(Object msg, Message message, Channel channel){
    String messageContent= null;
    try {
      messageContent = new String(message.getBody(),"UTF-8");
      System.out.println(messageContent);
    }catch (Exception e){
      e.printStackTrace();
    }
    System.out.println("done");
  }
}

